package com.voe;

/** Errors
 *
 */
public enum VoEErrors {

	// Warnings
	VE_PORT_NOT_DEFINED(8001),
	VE_CHANNEL_NOT_VALID(8002),
	VE_FUNC_NOT_SUPPORTED(8003),
	VE_INVALID_LISTNR(8004),
	VE_INVALID_ARGUMENT(8005),
	VE_INVALID_PORT_NMBR(8006),
	VE_INVALID_PLNAME(8007),
	VE_INVALID_PLFREQ(8008),
	VE_INVALID_PLTYPE(8009),
	VE_INVALID_PACSIZE(8010),
	VE_NOT_SUPPORTED(8011),
	VE_ALREADY_LISTENING(8012),
	VE_CHANNEL_NOT_CREATED(8013),
	VE_MAX_ACTIVE_CHANNELS_REACHED(8014),
	VE_REC_CANNOT_PREPARE_HEADER(8015),
	VE_REC_CANNOT_ADD_BUFFER(8016),
	VE_PLAY_CANNOT_PREPARE_HEADER(8017),
	VE_ALREADY_SENDING(8018),
	VE_INVALID_IP_ADDRESS(8019),
	VE_ALREADY_PLAYING(8020),
	VE_NOT_ALL_VERSION_INFO(8021),
	VE_DTMF_OUTOF_RANGE(8022),
	VE_INVALID_CHANNELS(8023),
	VE_SET_PLTYPE_FAILED(8024),
	VE_ENCRYPT_NOT_INITED(8025),
	VE_NOT_INITED(8026),
	VE_NOT_SENDING(8027),
	VE_EXT_TRANSPORT_NOT_SUPPORTED(8028),
	VE_EXTERNAL_TRANSPORT_ENABLED(8029),
	VE_STOP_RECORDING_FAILED(8030),
	VE_INVALID_RATE(8031),
	VE_INVALID_PACKET(8032),
	VE_NO_GQOS(8033),
	VE_INVALID_TIMESTAMP(8034),
	VE_RECEIVE_PACKET_TIMEOUT(8035),
	VE_STILL_PLAYING_PREV_DTMF(8036),
	VE_INIT_FAILED_WRONG_EXPIRY(8037),
	VE_SENDING(8038),
	VE_ENABLE_IPV6_FAILED(8039),
	VE_FUNC_NO_STEREO(8040),
	// Range(8041-8080 is not used
	VE_FW_TRAVERSAL_ALREADY_INITIALIZED(8081),
	VE_PACKET_RECEIPT_RESTARTED(8082),
	VE_NOT_ALL_INFO(8083),
	VE_CANNOT_SET_SEND_CODEC(8084),
	VE_CODEC_ERROR(8085),
	VE_NETEQ_ERROR(8086),
	VE_RTCP_ERROR(8087),
	VE_INVALID_OPERATION(8088),
	VE_CPU_INFO_ERROR(8089),
	VE_SOUNDCARD_ERROR(8090),
	VE_SPEECH_LEVEL_ERROR(8091),
	VE_SEND_ERROR(8092),
	VE_CANNOT_REMOVE_CONF_CHANNEL(8093),
	VE_PLTYPE_ERROR(8094),
	VE_SET_FEC_FAILED(8095),
	VE_CANNOT_GET_PLAY_DATA(8096),
	VE_APM_ERROR(8097),
	VE_RUNTIME_PLAY_WARNING(8098),
	VE_RUNTIME_REC_WARNING(8099),
	VE_NOT_PLAYING(8100),
	VE_SOCKETS_NOT_INITED(8101),
	VE_CANNOT_GET_SOCKET_INFO(8102),
	VE_INVALID_MULTICAST_ADDRESS(8103),
	VE_DESTINATION_NOT_INITED(8104),
	VE_RECEIVE_SOCKETS_CONFLICT(8105),
	VE_SEND_SOCKETS_CONFLICT(8106),
	VE_TYPING_NOISE_WARNING(8107),
	VE_SATURATION_WARNING(8108),
	VE_NOISE_WARNING(8109),
	VE_CANNOT_GET_SEND_CODEC(8110),
	VE_CANNOT_GET_REC_CODEC(8111),
	VE_ALREADY_INITED(8112),
	VE_CANNOT_SET_SECONDARY_SEND_CODEC(8113),
	VE_CANNOT_GET_SECONDARY_SEND_CODEC(8114),
	VE_CANNOT_REMOVE_SECONDARY_SEND_CODEC(8115),

	// Errors causing limited functionality
	VE_RTCP_SOCKET_ERROR(9001),
	VE_MIC_VOL_ERROR(9002),
	VE_SPEAKER_VOL_ERROR(9003),
	VE_CANNOT_ACCESS_MIC_VOL(9004),
	VE_CANNOT_ACCESS_SPEAKER_VOL(9005),
	VE_GET_MIC_VOL_ERROR(9006),
	VE_GET_SPEAKER_VOL_ERROR(9007),
	VE_THREAD_RTCP_ERROR(9008),
	VE_CANNOT_INIT_APM(9009),
	VE_SEND_SOCKET_TOS_ERROR(9010),
	VE_CANNOT_RETRIEVE_DEVICE_NAME(9013),
	VE_SRTP_ERROR(9014),
	//(9015 is not used
	VE_INTERFACE_NOT_FOUND(9016),
	VE_TOS_GQOS_CONFLICT(9017),
	VE_CANNOT_ADD_CONF_CHANNEL(9018),
	VE_BUFFER_TOO_SMALL(9019),
	VE_CANNOT_EXECUTE_SETTING(9020),
	VE_CANNOT_RETRIEVE_SETTING(9021),
	//(9022 is not used
	VE_RTP_KEEPALIVE_FAILED(9023),
	VE_SEND_DTMF_FAILED(9024),
	VE_CANNOT_RETRIEVE_CNAME(9025),
	VE_DECRYPTION_FAILED(9026),
	VE_ENCRYPTION_FAILED(9027),
	VE_CANNOT_RETRIEVE_RTP_STAT(9028),
	VE_GQOS_ERROR(9029),
	VE_BINDING_SOCKET_TO_LOCAL_ADDRESS_FAILED(9030),
	VE_TOS_INVALID(9031),
	VE_TOS_ERROR(9032),
	VE_CANNOT_RETRIEVE_VALUE(9033),

	// Critical errors that stops voice functionality
	VE_PLAY_UNDEFINED_SC_ERR(10001),
	VE_REC_CANNOT_OPEN_SC(10002),
	VE_SOCKET_ERROR(10003),
	VE_MMSYSERR_INVALHANDLE(10004),
	VE_MMSYSERR_NODRIVER(10005),
	VE_MMSYSERR_NOMEM(10006),
	VE_WAVERR_UNPREPARED(10007),
	VE_WAVERR_STILLPLAYING(10008),
	VE_UNDEFINED_SC_ERR(10009),
	VE_UNDEFINED_SC_REC_ERR(10010),
	VE_THREAD_ERROR(10011),
	VE_CANNOT_START_RECORDING(10012),
	VE_PLAY_CANNOT_OPEN_SC(10013),
	VE_NO_WINSOCK_2(10014),
	VE_SEND_SOCKET_ERROR(10015),
	VE_BAD_FILE(10016),
	VE_EXPIRED_COPY(10017),
	VE_NOT_AUTHORISED(10018),
	VE_RUNTIME_PLAY_ERROR(10019),
	VE_RUNTIME_REC_ERROR(10020),
	VE_BAD_ARGUMENT(10021),
	VE_LINUX_API_ONLY(10022),
	VE_REC_DEVICE_REMOVED(10023),
	VE_NO_MEMORY(10024),
	VE_BAD_HANDLE(10025),
	VE_RTP_RTCP_MODULE_ERROR(10026),
	VE_AUDIO_CODING_MODULE_ERROR(10027),
	VE_AUDIO_DEVICE_MODULE_ERROR(10028),
	VE_CANNOT_START_PLAYOUT(10029),
	VE_CANNOT_STOP_RECORDING(10030),
	VE_CANNOT_STOP_PLAYOUT(10031),
	VE_CANNOT_INIT_CHANNEL(10032),
	VE_RECV_SOCKET_ERROR(10033),
	VE_SOCKET_TRANSPORT_MODULE_ERROR(10034),
	VE_AUDIO_CONF_MIX_MODULE_ERROR(10035),

	// Warnings for other platforms (reserved range(8061-8080)
	VE_IGNORED_FUNCTION(8061);

	public static VoEErrors fromValue(int value) {
		for (int i=0;i<VoEErrors.values().length;i++) {
			if(VoEErrors.values()[i].getValue() == value)
				return VoEErrors.values()[i];
		}
		return null;
	}

	/**
	 * Constructor.
	 */
	private VoEErrors(int value) {
		this.value = value;
	}

	/**
	 * Get the value.
	 * 
	 * @return the value
	 */
	public int getValue() {
		return value;
	}

	private final int value;
}
